package com.csd.controller;

import com.csd.pojo.SysUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttribute;

import javax.servlet.http.HttpSession;

/**
 * @ Author :lihainan
 * @ ClassNmae :IndexController
 * @ Description :TODO
 * @ Date :2020/12/22
 * @ Version 1.0
 * 首页控制层
 */
@Controller
public class IndexController {
    /**
     * 首页
     */
    @RequestMapping("/")
    public String indexShow(){

        return "pagehome/index";
    }

    /**
     * 回到首页
     * @return
     */
    @RequestMapping("/index")
    public String index(HttpSession session){
        SysUser users = (SysUser) session.getAttribute("user");
        if (users!=null){
            return "pagehome/loginsuccess";
        }else {
            return "pagehome/index";
        }
    }

    /**
     * 注册
     */
    @RequestMapping("/register")
    public String showRegister(){
        return "pagehome/register";
    }

    /**
     * 登录
     */
    @RequestMapping("/login")
    public String showLogin(SysUser sysUser){
        return "pagehome/login";
    }

    /**
     * 登录成功
     * @return
     */
    @RequestMapping("/loginsuccess")
    public String loginSuccess(){
        return "pagehome/loginsuccess";
    }

    /**
     * 短驾自租
     * @return
     */
    @RequestMapping("/shortrent")
    public String showshortrent(){
        return "shortRent/shortrent";
    }

    /**
     * 去选车界面
     * @return
     */
    @RequestMapping("/shortsort")
    public String showshortsort(){
        return "shortRent/shortsort";
    }

    /**
     * 管理员登录页面
     * @return
     */
    @RequestMapping("/adminLogin")
    public String showAdminLogin(){
        return "admin/login";
    }

    /**
     * 管理员页面
     * @return
     */
    @RequestMapping("/adminsuccess")
    public String showAdmin(){
        return "admin/admin";
    }
    /**
     * 管理员管理用户页面
     * @return
     */
    @RequestMapping("/userList")
    public String showuserList(){
        return "admin/userList";
    }
    /**
     * 订单页面
     * @return
     */
    @RequestMapping("/mymain")
    public String showuserorder(HttpSession session){
        return "mymain/mymain";
    }
    /**
     * 修改个人信息页面
     * @return
     */
    @RequestMapping("/myinfo")
    public String showmyinfo(HttpSession session){
        return "mymain/myinfo";
    }


    /**
     * 提交订单
     * @return
     */
    @RequestMapping("/ordersubmit")
    public String showOrder(){
        return "order/ordersubmit";
    }
}
